package com.bienvenue.main.ui.activity.personal;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.bienvenue.main.R;
import com.bienvenue.main.adapter.HotPositionListAdapter;
import com.bienvenue.main.adapter.PositionDetailsListAdapter;
import com.bienvenue.main.adapter.PositionTypeListAdapter;
import com.bienvenue.main.base.BaseActivity;
import com.chad.library.adapter.base.BaseQuickAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @ProjectName: Bienvenue
 * @Package: com.bienvenue.main.ui.activity
 * @ClassName: PositionsTypeActivity
 * @Description: 职位类型
 * @Author: Mr.Chen
 * @CreateDate: 2020/9/8 11:08
 * @UpdateUser: Mr.Chen
 * @UpdateDate: 2020/9/8 11:08
 * @UpdateRemark: 职位类型
 * @Version: 1.0
 */


public class PositionsTypeActivity extends BaseActivity {


    List<String> stringList = new ArrayList<>();

    List<String> positionTypeList = new ArrayList<>();

    List<String> detailsLit = new ArrayList<>();

    @BindView(R.id.rv_hot_position_list)
    RecyclerView rvHotPositionList;
    @BindView(R.id.rv_position_type_list)
    RecyclerView rvPositionTypeList;
    @BindView(R.id.rv_position_details_list)
    RecyclerView rvPositionDetailsList;

    HotPositionListAdapter mAdapter;
    PositionTypeListAdapter positionTypeListAdapter;
    PositionDetailsListAdapter detailsListAdapter;

    @Override
    protected void initData() {
        mAdapter = new HotPositionListAdapter();
        positionTypeListAdapter = new PositionTypeListAdapter();
        detailsListAdapter = new PositionDetailsListAdapter();

        rvHotPositionList.setAdapter(mAdapter);
        stringList.add("软件开发");
        stringList.add("UI设计师");
        stringList.add("java");
        stringList.add("前端开发");
        mAdapter.setNewData(stringList);
        mAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
            @Override
            public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
                showToast("此功能暂未实现");
            }
        });
        rvPositionTypeList.setAdapter(positionTypeListAdapter);
        positionTypeList.add("IT/互联网");
        positionTypeList.add("设计");
        positionTypeList.add("运营");
        positionTypeList.add("市场");
        positionTypeList.add("人事财务");
        positionTypeList.add("销售");
        positionTypeList.add("传媒");
        positionTypeList.add("金融");
        positionTypeList.add("教育培训");
        positionTypeListAdapter.setNewData(positionTypeList);


        View view = View.inflate(this, R.layout.top_details_view, null);
        TextView tvDetailsPrompt = view.findViewById(R.id.tv_details);
        detailsListAdapter.addHeaderView(view);
        positionTypeListAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
            @Override
            public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
                showToast("此功能暂未实现");
                tvDetailsPrompt.setText(positionTypeListAdapter.getData().get(position));
            }
        });
        detailsLit.add("高级管理职位");
        detailsLit.add("高级管理职位");
        detailsLit.add("高级管理职位");
        detailsLit.add("高级管理职位");
        detailsLit.add("高级管理职位");
        detailsLit.add("高级管理职位");
        detailsLit.add("高级管理职位");
        detailsLit.add("高级管理职位");
        rvPositionDetailsList.setAdapter(detailsListAdapter);
        detailsListAdapter.setNewData(detailsLit);


        detailsListAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
            @Override
            public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
                showToast("此功能暂未实现");
            }
        });


    }

    @Override
    protected void initView() {
        LinearLayoutManager manager = new LinearLayoutManager(this);
        manager.setOrientation(LinearLayoutManager.HORIZONTAL);
        rvHotPositionList.setLayoutManager(manager);
        rvPositionTypeList.setLayoutManager(new LinearLayoutManager(this));
        rvPositionDetailsList.setLayoutManager(new GridLayoutManager(this, 2));


    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_positions_type;
    }

    @OnClick(R.id.iv_return_btn)
    void onFinish() {
        this.finish();
    }
}
